/***************************************************************************************************
  *Copyright(C),2017-2020,Sumscope
  *FileName	:  FixedNatFutureChartControl
  *Author	:  Givins.zhu
  *Version	:  2.0
  *Date		:  2019/10/12
  *Desc		:  
  *History	:
  *Email    :  Givins.zhu@sumscope.com  
***************************************************************************************************/
#pragma once
#include <QStylePainter>

class CFixedNatFutureData;
//namespace paint{ class UIRender; }

enum emFixedDraw{
	FDraw_Back = 0,
	FDraw_Border,
	FDraw_PrcLine, //价格
	FDraw_InteLine,//持仓量
	FDraw_Bar,//现手
	FDraw_Time,//时间
	FDraw_Max
};

#define  FIXED_NAT_ELE_POINT_MAX 273  //最多272个点

class CFixedFutureChartElement
{
public:
	CFixedFutureChartElement(){ m_nChartType = FDraw_Back; m_pData = nullptr; }
	void setData(CFixedNatFutureData* pData, bool bToday){ 
		m_pData = pData;
		m_bToday = bToday;
	}
	virtual void drawElement(QStylePainter* painter, const QRect& rcRct,int nCurPt =-1, QWidget* pParent = nullptr){}

protected:
	int m_nChartType;
	CFixedNatFutureData* m_pData;
	QPoint m_pointArr[FIXED_NAT_ELE_POINT_MAX];
	bool m_bToday;//是否今天的数据
};

/*边框*/
class CFixedFutureChartBorder : public CFixedFutureChartElement{
public:
	CFixedFutureChartBorder(){ m_nChartType = FDraw_Border; }
	virtual void drawElement(QStylePainter* painter, const QRect& rcRct, int nCurPt = -1, QWidget* pParent = nullptr);
};

/*曲线基类*/
class CFixedFutureChartLineBase : public CFixedFutureChartElement{
public:
	virtual void drawElement(QStylePainter* painter, const QRect& rcRct, int nCurPt = -1, QWidget* pParent = nullptr);
};

/*曲线,价格*/
class CFixedFutureChartPrcLine : public CFixedFutureChartLineBase{
public:
	CFixedFutureChartPrcLine(){ m_nChartType = FDraw_PrcLine; }
};

/*柱状,现手*/
class CFixedFutureChartBar : public CFixedFutureChartElement{
public:
	CFixedFutureChartBar(){ m_nChartType = FDraw_Bar; }
	virtual void drawElement(QStylePainter* painter, const QRect& rcRct, int nCurPt = -1, QWidget* pParent = nullptr);
};

/*持仓量*/
class CFixedFutureChartOpenInst : public CFixedFutureChartLineBase{
public:
	CFixedFutureChartOpenInst(){ m_nChartType = FDraw_InteLine; }
};

/*时间*/
class CFixedFutureChartTime : public CFixedFutureChartElement{
public:
	CFixedFutureChartTime();
	virtual void drawElement(QStylePainter* painter, const QRect& rcRct, int nCurPt = -1, QWidget* pParent = nullptr);
private:
	void buildXPosTxt();
	std::map<int/*第几个点*/, QString> m_mapFixedTxt;//默认自动生成
	QColor m_clrXpos;
};
